//
//  ZLCollectionViewCell.m
//  TripTogether
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 张磊. All rights reserved.
//

#import "ZLCollectionViewCell.h"


@interface ZLCollectionViewCell ()

@property (nonatomic, strong)UIImageView *myImageView;

@property (nonatomic, strong)UILabel *nameLabel;


@end

@implementation ZLCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.myImageView = [[UIImageView alloc]init];
        
        self.myImageView.contentMode = UIViewContentModeScaleAspectFill;
        
//        self.myImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.myImageView];
        [self.myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
           
            make.left.top.equalTo(self.contentView);
            make.width.mas_equalTo((SCREEN_WIDTH - 27*AUTO_WIDTH)/2);
            make.height.mas_equalTo((SCREEN_WIDTH - 25*AUTO_WIDTH)/2);
            
        }];
        self.myImageView.layer.masksToBounds = YES;
        self.myImageView.layer.cornerRadius = 8*AUTO_WIDTH;
        
        self.nameLabel = [UILabel new];
        self.nameLabel.textAlignment = NSTextAlignmentCenter;
        self.nameLabel.textColor = [UIColor whiteColor];
        [self.myImageView addSubview:self.nameLabel];
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.right.bottom.equalTo(self.myImageView);
            make.height.equalTo(@(40*AUTO_HEIGHT));
           
        }];
    }
    return self;
}

-(void)setZlDataM:(ZLDataMOdel *)zlDataM
{
    [self.myImageView sd_setImageWithURL:[NSURL URLWithString:zlDataM.cover] placeholderImage:PICHOLDEER];
    
    self.nameLabel.text = zlDataM.name;
}




@end
